home *** CD-ROM | disk | FTP | other *** search
- /*
- * Source machine generated by GadToolsBox V2.0b
- * which is (c) Copyright 1991-1993 Jaba Development
- *
- * GUI Designed by : -- Unnamed --
- */
-
- #include "PostPre.h"
- #include "PostWin.h"
- #include "Global.h"
-
- extern APTR my_VisualInfo;
- extern struct Screen *screen;
-
- struct Window *OptionsWnd = NULL;
- struct Window *ChoosePSWnd = NULL;
- struct Window *GotoPageWnd = NULL;
- struct Gadget *OptionsGList = NULL;
- struct Gadget *ChoosePSGList = NULL;
- struct Gadget *GotoPageGList = NULL;
- struct Menu *MenuMenus = NULL;
- struct Menu *OptionsMenus = NULL;
- struct IntuiMessage OptionsMsg;
- struct IntuiMessage ChoosePSMsg;
- struct IntuiMessage GotoPageMsg;
- struct Gadget *OptionsGadgets[30];
- struct Gadget *ChoosePSGadgets[3];
- struct Gadget *GotoPageGadgets[1];
- extern Class *initGet( void );
- struct IClass *getClass = NULL;
- struct _Object *getImage = NULL;
- UWORD OptionsLeft = 0;
- UWORD OptionsTop = 15;
- UWORD OptionsWidth = 495;
- UWORD OptionsHeight = 187;
- UWORD ChoosePSLeft = 0;
- UWORD ChoosePSTop = 0;
- UWORD ChoosePSWidth = 215;
- UWORD ChoosePSHeight = 76;
- UWORD GotoPageLeft = 0;
- UWORD GotoPageTop = 17;
- UWORD GotoPageWidth = 207;
- UWORD GotoPageHeight = 33;
- UBYTE *OptionsWdt = NULL;
- UBYTE *ChoosePSWdt = (UBYTE *)"Choose Public Screen";
- UBYTE *GotoPageWdt = (UBYTE *)"Goto Page";
- struct TextAttr *Font, Attr;
- UWORD FontX, FontY;
- UWORD OffX, OffY;
-
- UBYTE *OptColor0Labels[] = {
- (UBYTE *)"_BW",
- (UBYTE *)"_RGB",
- (UBYTE *)"C_MYK",
- NULL };
-
- UBYTE *OptPrDen0Labels[] = {
- (UBYTE *)"Density = 1",
- (UBYTE *)"Density = 2",
- (UBYTE *)"Density = 3",
- (UBYTE *)"Density = 4",
- (UBYTE *)"Density = 5",
- (UBYTE *)"Density = 6",
- (UBYTE *)"Density = 7",
- NULL };
-
- struct NewMenu OptionsNewMenu[] = {
- {NM_TITLE, (STRPTR)"Options", NULL, 0, NULL, NULL,},
- {NM_ITEM, (STRPTR)"Open ...", (STRPTR)"O", 0, 0L, (APTR)OptionsMenuOpen,},
- {NM_ITEM, (STRPTR)"Save As ...", (STRPTR)"A", 0, 0L, (APTR)OptionsMenuSave,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Reset To Defaults", (STRPTR)"D", 0, 0L, (APTR)OptionsMenuDefaults,},
- {NM_ITEM, (STRPTR)"Last Saved", (STRPTR)"L", 0, 0L, (APTR)OptionsMenuLastSaved,},
- {NM_END, NULL, NULL, 0, 0L, NULL}, };
-
- struct NewMenu MenuNewMenu[] = {
- {NM_TITLE, (STRPTR)"Project", NULL, 0, NULL, NULL,},
- {NM_ITEM, (STRPTR)"New", (STRPTR)"N", 0, 0L, (APTR)MenuNew,},
- {NM_ITEM, (STRPTR)"Clear", (STRPTR)"C", 0, 0L, (APTR)MenuClear,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Open File...", (STRPTR)"O", 0, 0L, (APTR)MenuOpen,},
- {NM_ITEM, (STRPTR)"Run File ...", (STRPTR)"R", 0, 0L, (APTR)MenuRun,},
- {NM_ITEM, (STRPTR)"Load Font ...", (STRPTR)"F", 0, 0L, (APTR)MenuFont,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Save As Iff ...", (STRPTR)"S", 0, 0L, (APTR)MenuIff,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Print ...", (STRPTR)"P", 0, 0L, (APTR)MenuPrint,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"About ...", (STRPTR)"?", 0, 0L, (APTR)MenuAbout,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Quit", (STRPTR)"Q", 0, 0L, (APTR)MenuQuit,},
- {NM_TITLE, (STRPTR)"Control", NULL, 0, NULL, NULL,},
- {NM_ITEM, (STRPTR)"Pause Every Page", (STRPTR)"Y", CHECKIT|CHECKED, 0L, (APTR)MenuPause,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Next Page", (STRPTR)"+", 0, 0L, (APTR)MenuNext,},
- {NM_ITEM, (STRPTR)"Previous Page", (STRPTR)"-", 0, 0L, (APTR)MenuPrevious,},
- {NM_ITEM, (STRPTR)"Goto Page ...", (STRPTR)"G", 0, 0L, (APTR)MenuGoto,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Interrupt", (STRPTR)"I", 0, 0L, (APTR)MenuInterrupt,},
- {NM_ITEM, (STRPTR)"Kill", (STRPTR)"K", 0, 0L, (APTR)MenuKill,},
- {NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,},
- {NM_ITEM, (STRPTR)"Interactive", (STRPTR)"V", 0, 0L, (APTR)MenuInteractive,},
- {NM_TITLE, (STRPTR)"Prefs", NULL, 0, NULL, NULL,},
- {NM_ITEM, (STRPTR)"Public Screen", (STRPTR)"B", CHECKIT, 2L, (APTR)MenuPubScreen,},
- {NM_ITEM, (STRPTR)"Custom Screen", (STRPTR)"M", CHECKIT|CHECKED, 1L, (APTR)MenuCustomScreen,},
- {NM_ITEM, (STRPTR)"Edit ...", (STRPTR)"E", 0, 0L, (APTR)MenuOptions,},
- {NM_END, NULL, NULL, 0, 0L, NULL}, };
-
- UWORD OptionsGTypes[] = {
- INTEGER_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- LISTVIEW_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- MX_KIND,
- CYCLE_KIND,
- STRING_KIND,
- INTEGER_KIND,
- INTEGER_KIND,
- CHECKBOX_KIND,
- GENERIC_KIND,
- CHECKBOX_KIND,
- CHECKBOX_KIND,
- INTEGER_KIND,
- CHECKBOX_KIND,
- CHECKBOX_KIND,
- STRING_KIND,
- INTEGER_KIND
- };
-
- UWORD ChoosePSGTypes[] = {
- LISTVIEW_KIND,
- BUTTON_KIND,
- BUTTON_KIND
- };
-
- UWORD GotoPageGTypes[] = {
- INTEGER_KIND
- };
-
- struct NewGadget OptionsNGad[] = {
- {246, 14, 71, 12, (UBYTE *)"_Width", NULL, GD_OptWidth, PLACETEXT_LEFT, NULL, (APTR)OptWidthClicked,},
- {246, 29, 71, 12, (UBYTE *)"Height", NULL, GD_OptHeight, PLACETEXT_LEFT, NULL, (APTR)OptHeightClicked,},
- {246, 44, 71, 12, (UBYTE *)"XOffset", NULL, GD_OptXOff, PLACETEXT_LEFT, NULL, (APTR)OptXOffClicked,},
- {246, 59, 71, 12, (UBYTE *)"YOffset", NULL, GD_OptYOff, PLACETEXT_LEFT, NULL, (APTR)OptYOffClicked,},
- {246, 74, 71, 12, (UBYTE *)"XDPI", NULL, GD_OptXDPI, PLACETEXT_LEFT, NULL, (APTR)OptXDPIClicked,},
- {246, 89, 71, 12, (UBYTE *)"YDPI", NULL, GD_OptYDPI, PLACETEXT_LEFT, NULL, (APTR)OptYDPIClicked,},
- {11, 14, 140, 40, (UBYTE *)"Startup File(s)", NULL, GD_OptStartUp, PLACETEXT_ABOVE, NULL, (APTR)OptStartUpClicked,},
- {11, 54, 56, 12, (UBYTE *)"New", NULL, GD_OptNew, PLACETEXT_IN, NULL, (APTR)OptNewClicked,},
- {96, 54, 56, 12, (UBYTE *)"Del", NULL, GD_OptDel, PLACETEXT_IN, NULL, (APTR)OptDelClicked,},
- {246, 104, 71, 12, (UBYTE *)"Fonts", NULL, GD_OptFonts, PLACETEXT_LEFT, NULL, (APTR)OptFontsClicked,},
- {246, 119, 71, 12, (UBYTE *)"Htone", NULL, GD_OptHtone, PLACETEXT_LEFT, NULL, (APTR)OptHtoneClicked,},
- {246, 134, 71, 12, (UBYTE *)"VM", NULL, GD_OptVM, PLACETEXT_LEFT, NULL, (APTR)OptVMClicked,},
- {246, 149, 71, 12, (UBYTE *)"Paths", NULL, GD_OptPaths, PLACETEXT_LEFT, NULL, (APTR)OptPathsClicked,},
- {11, 169, 141, 12, (UBYTE *)"_Save", NULL, GD_OptSave, PLACETEXT_IN, NULL, (APTR)OptSaveClicked,},
- {176, 169, 141, 12, (UBYTE *)"_Use", NULL, GD_OptUse, PLACETEXT_IN, NULL, (APTR)OptUseClicked,},
- {341, 169, 141, 12, (UBYTE *)"_Cancel", NULL, GD_OptCancel, PLACETEXT_IN, NULL, (APTR)OptCancelClicked,},
- {76, 124, 17, 9, NULL, NULL, GD_OptColor, PLACETEXT_LEFT, NULL, (APTR)OptColorClicked,},
- {341, 44, 141, 12, (UBYTE *)"Printer Density", NULL, GD_OptPrDen, PLACETEXT_ABOVE, NULL, (APTR)OptPrDenClicked,},
- {371, 14, 111, 12, (UBYTE *)"IFF File Name", NULL, GD_OptIff, PLACETEXT_ABOVE, NULL, (APTR)OptIffClicked,},
- {411, 104, 71, 12, (UBYTE *)"From", NULL, GD_OptFrom, PLACETEXT_LEFT, NULL, (APTR)OptFromClicked,},
- {411, 119, 71, 12, (UBYTE *)"To", NULL, GD_OptTo, PLACETEXT_LEFT, NULL, (APTR)OptToClicked,},
- {456, 89, 26, 11, (UBYTE *)"_All Pages", NULL, GD_OptAllPages, PLACETEXT_LEFT, NULL, (APTR)OptAllPagesClicked,},
- {341, 14, 20, 14, NULL, NULL, GD_OptGetIff, 0, NULL, (APTR)OptGetIffClicked,},
- {456, 74, 26, 11, (UBYTE *)"FormFeed", NULL, GD_OptFF, PLACETEXT_LEFT, NULL, (APTR)OptFFClicked,},
- {456, 59, 26, 11, (UBYTE *)"CenterPage", NULL, GD_OptCenter, PLACETEXT_LEFT, NULL, (APTR)OptCenterClicked,},
- {411, 149, 71, 12, (UBYTE *)"Bandsize", NULL, GD_OptBand, PLACETEXT_LEFT, NULL, (APTR)OptBandClicked,},
- {456, 134, 26, 11, (UBYTE *)"Ban_drendering", NULL, GD_OptBandrender, PLACETEXT_LEFT, NULL, (APTR)OptBandrenderClicked,},
- {126, 74, 26, 11, (UBYTE *)"Graphiccard", NULL, GD_OptGraphiccard, PLACETEXT_LEFT, NULL, (APTR)OptGraphiccardClicked,},
- {81, 89, 71, 12, (UBYTE *)"Path", NULL, GD_OptTemppath, PLACETEXT_LEFT, NULL, (APTR)OptTemppathClicked,},
- {81, 104, 71, 12, (UBYTE *)"Buffer", NULL, GD_OptBuffer, PLACETEXT_LEFT, NULL, (APTR)OptBufferClicked},
- };
-
- struct NewGadget ChoosePSNGad[] = {
- {11, 8, 191, 48, NULL, NULL, GD_PubScreenLV, 0, NULL, (APTR)PubScreenLVClicked,},
- {131, 59, 71, 12, (UBYTE *)"_Cancel", NULL, GD_CPSCancel, PLACETEXT_IN, NULL, (APTR)CPSCancelClicked,},
- {11, 59, 71, 12, (UBYTE *)"_Ok", NULL, GD_CPSOk, PLACETEXT_IN, NULL, (APTR)CPSOkClicked},
- };
-
- struct NewGadget GotoPageNGad[] = {
- {116, 8, 71, 15, (UBYTE *)"Page Number:", NULL, GD_GotoPage, PLACETEXT_LEFT, NULL, (APTR)GotoPageClicked},
- };
-
- ULONG OptionsGTags[] = {
- (GTIN_Number), 618, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (GT_Underscore), '_', (TAG_DONE),
- (GTIN_Number), 876, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 75, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 75, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTLV_Labels), NULL, (GTLV_ShowSelected), NULL, (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GTIN_Number), 60000, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 20000, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 50000, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GTIN_Number), 10000, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GTMX_Active), 1, (GTMX_Labels), (ULONG)&OptColor0Labels[ 0 ], (GTMX_Spacing), 5, (GT_Underscore), '_', (TAG_DONE),
- (GTCY_Active), 2, (GTCY_Labels), (ULONG)&OptPrDen0Labels[ 0 ], (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GTST_String), NULL, (GTST_MaxChars), 256, (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GTIN_Number), 1, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GTIN_Number), 1, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (GA_Disabled), TRUE, (TAG_DONE),
- (GTCB_Checked), TRUE, (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GA_Disabled), TRUE, (TAG_DONE),
- (GTCB_Checked), TRUE, (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GTCB_Checked), TRUE, (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GTIN_Number), 400, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (GTCB_Checked), TRUE, (GT_Underscore), '_', (GA_Disabled), TRUE, (TAG_DONE),
- (TAG_DONE),
- (GTST_String), (ULONG)"T:", (GTST_MaxChars), 256, (TAG_DONE),
- (GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE)
- };
-
- ULONG ChoosePSGTags[] = {
- (GTLV_ShowSelected), NULL, (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE)
- };
-
- ULONG GotoPageGTags[] = {
- (GTIN_Number), 0, (GTIN_MaxChars), 10, (STRINGA_Justification), (GACT_STRINGCENTER), (TAG_DONE)
- };
-
- static UWORD ComputeX( UWORD value )
- {
- return(( UWORD )((( FontX * value ) + 4 ) / 8 ));
- }
-
- static UWORD ComputeY( UWORD value )
- {
- return(( UWORD )((( FontY * value ) + 4 ) / 8 ));
- }
-
- static void ComputeFont( UWORD width, UWORD height )
- {
- Font = &Attr;
- Font->ta_Name = (STRPTR)screen->RastPort.Font->tf_Message.mn_Node.ln_Name;
- Font->ta_YSize = FontY = screen->RastPort.Font->tf_YSize;
- FontX = screen->RastPort.Font->tf_XSize;
-
- OffX = screen->WBorLeft;
- OffY = screen->RastPort.TxHeight + screen->WBorTop + 1;
-
- if ( width && height ) {
- if (( ComputeX( width ) + OffX + screen->WBorRight ) > screen->Width )
- goto UseTopaz;
- if (( ComputeY( height ) + OffY + screen->WBorBottom ) > screen->Height )
- goto UseTopaz;
- }
- return;
-
- UseTopaz:
- Font->ta_Name = (STRPTR)"topaz.font";
- FontX = FontY = Font->ta_YSize = 8;
- }
-
- int HandleOptionsIDCMP( void )
- {
- struct IntuiMessage *m;
- struct MenuItem *n;
- int (*func)(void);
- BOOL running = TRUE;
-
- while( m = GT_GetIMsg( OptionsWnd->UserPort )) {
-
- CopyMem(( char * )m, ( char * )&OptionsMsg, (long)sizeof( struct IntuiMessage ));
-
- GT_ReplyIMsg( m );
-
- switch ( OptionsMsg.Class ) {
-
- case IDCMP_REFRESHWINDOW:
- GT_BeginRefresh( OptionsWnd );
- GT_EndRefresh( OptionsWnd, TRUE );
- break;
-
- case IDCMP_CLOSEWINDOW:
- running = OptionsCloseWindow();
- break;
-
- case IDCMP_VANILLAKEY:
- running = OptionsVanillaKey();
- break;
-
- case IDCMP_GADGETUP:
- case IDCMP_GADGETDOWN:
- func = ( void * )(( struct Gadget * )OptionsMsg.IAddress )->UserData;
- running = func();
- break;
-
- case IDCMP_MENUPICK:
- while( OptionsMsg.Code != MENUNULL ) {
- n = ItemAddress( OptionsMenus, OptionsMsg.Code );
- func = (void *)(GTMENUITEM_USERDATA( n ));
- running = func();
- OptionsMsg.Code = n->NextSelect;
- }
- break;
- }
- }
- return( running );
- }
-
- int OpenOptionsWindow( void )
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD wleft = OptionsLeft, wtop = OptionsTop, ww, wh;
-
- ComputeFont( OptionsWidth, OptionsHeight );
-
- ww = ComputeX( OptionsWidth );
- wh = ComputeY( OptionsHeight );
-
- if (( wleft + ww + OffX + screen->WBorRight ) > screen->Width ) wleft = screen->Width - ww;
- if (( wtop + wh + OffY + screen->WBorBottom ) > screen->Height ) wtop = screen->Height - wh;
-
- if ( ! ( getClass = initGet()))
- return( 3L );
-
- if ( ! ( getImage = NewObject( getClass, NULL, GT_VisualInfo, (ULONG) my_VisualInfo, TAG_DONE )))
- return( 4L );
-
-
- if ( ! ( g = CreateContext( &OptionsGList )))
- return( 1L );
-
- for( lc = 0, tc = 0; lc < Options_CNT; lc++ ) {
-
- CopyMem((char * )&OptionsNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
-
- ng.ng_VisualInfo = my_VisualInfo;
- ng.ng_TextAttr = Font;
- ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
- ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
-
- if ( OptionsGTypes[ lc ] != GENERIC_KIND ) {
- ng.ng_Width = ComputeX( ng.ng_Width );
- ng.ng_Height = ComputeY( ng.ng_Height);
- }
-
- OptionsGadgets[ lc ] = g = CreateGadgetA((ULONG)OptionsGTypes[ lc ], g, &ng, ( struct TagItem * )&OptionsGTags[ tc ] );
-
- if ( OptionsGTypes[ lc ] == GENERIC_KIND ) {
- g->Flags |= GFLG_GADGIMAGE | GFLG_GADGHIMAGE;
- g->Activation |= GACT_RELVERIFY;
- g->GadgetRender = (APTR)getImage;
- g->SelectRender = (APTR)getImage;
- }
-
- while( OptionsGTags[ tc ] ) tc += 2;
- tc++;
-
- if ( NOT g )
- return( 2L );
- }
- if ( ! ( OptionsMenus = CreateMenus( OptionsNewMenu, TAG_DONE )))
- return( 5L );
-
- LayoutMenus( OptionsMenus, my_VisualInfo, GTMN_NewLookMenus, TRUE, TAG_DONE );
-
- if ( ! ( OptionsWnd = OpenWindowTags( NULL,
- WA_Left, wleft,
- WA_Top, wtop,
- WA_Width, ww + OffX + screen->WBorRight,
- WA_Height, wh + OffY + screen->WBorBottom,
- WA_IDCMP, INTEGERIDCMP|LISTVIEWIDCMP|BUTTONIDCMP|MXIDCMP|CYCLEIDCMP|STRINGIDCMP|CHECKBOXIDCMP|IDCMP_GADGETUP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
- WA_Gadgets, (ULONG) OptionsGList,
- WA_Title, (ULONG) OptionsWdt,
- WA_NewLookMenus, TRUE,
- WA_PubScreen, (ULONG) screen,
- TAG_DONE )))
- return( 4L );
-
- SetMenuStrip( OptionsWnd, OptionsMenus );
- GT_RefreshWindow( OptionsWnd, NULL );
-
- return( 0L );
- }
-
- void CloseOptionsWindow( void )
- {
- if ( OptionsMenus ) {
- ClearMenuStrip( OptionsWnd );
- FreeMenus( OptionsMenus );
- OptionsMenus = NULL; }
-
- if ( OptionsWnd ) {
- CloseWindow( OptionsWnd );
- OptionsWnd = NULL;
- }
-
- if ( OptionsGList ) {
- FreeGadgets( OptionsGList );
- OptionsGList = NULL;
- }
-
- if ( getImage ) {
- DisposeObject( getImage );
- getImage = NULL;
- }
-
- if ( getClass ) {
- FreeClass( getClass );
- getClass = NULL;
- }
-
- }
-
- int HandleChoosePSIDCMP( void )
- {
- struct IntuiMessage *m;
- int (*func)(void);
- BOOL running = TRUE;
-
- while( m = GT_GetIMsg( ChoosePSWnd->UserPort )) {
-
- CopyMem(( char * )m, ( char * )&ChoosePSMsg, (long)sizeof( struct IntuiMessage ));
-
- GT_ReplyIMsg( m );
-
- switch ( ChoosePSMsg.Class ) {
-
- case IDCMP_REFRESHWINDOW:
- GT_BeginRefresh( ChoosePSWnd );
- GT_EndRefresh( ChoosePSWnd, TRUE );
- break;
-
- case IDCMP_CLOSEWINDOW:
- running = ChoosePSCloseWindow();
- break;
-
- case IDCMP_VANILLAKEY:
- running = ChoosePSVanillaKey();
- break;
-
- case IDCMP_GADGETUP:
- case IDCMP_GADGETDOWN:
- func = ( void * )(( struct Gadget * )ChoosePSMsg.IAddress )->UserData;
- running = func();
- break;
- }
- }
- return( running );
- }
-
- int OpenChoosePSWindow( void )
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD wleft = ChoosePSLeft, wtop = ChoosePSTop, ww, wh;
-
- ComputeFont( ChoosePSWidth, ChoosePSHeight );
-
- ww = ComputeX( ChoosePSWidth );
- wh = ComputeY( ChoosePSHeight );
-
- if (( wleft + ww + OffX + screen->WBorRight ) > screen->Width ) wleft = screen->Width - ww;
- if (( wtop + wh + OffY + screen->WBorBottom ) > screen->Height ) wtop = screen->Height - wh;
-
- if ( ! ( g = CreateContext( &ChoosePSGList )))
- return( 1L );
-
- for( lc = 0, tc = 0; lc < ChoosePS_CNT; lc++ ) {
-
- CopyMem((char * )&ChoosePSNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
-
- ng.ng_VisualInfo = my_VisualInfo;
- ng.ng_TextAttr = Font;
- ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
- ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
- ng.ng_Width = ComputeX( ng.ng_Width );
- ng.ng_Height = ComputeY( ng.ng_Height);
-
- ChoosePSGadgets[ lc ] = g = CreateGadgetA((ULONG)ChoosePSGTypes[ lc ], g, &ng, ( struct TagItem * )&ChoosePSGTags[ tc ] );
-
- while( ChoosePSGTags[ tc ] ) tc += 2;
- tc++;
-
- if ( NOT g )
- return( 2L );
- }
-
- if ( ! ( ChoosePSWnd = OpenWindowTags( NULL,
- WA_Left, wleft,
- WA_Top, wtop,
- WA_Width, ww + OffX + screen->WBorRight,
- WA_Height, wh + OffY + screen->WBorBottom,
- WA_IDCMP, LISTVIEWIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
- WA_Gadgets, (ULONG) ChoosePSGList,
- WA_Title, (ULONG) ChoosePSWdt,
- WA_ScreenTitle, (ULONG) "Choose Public Screen",
- WA_PubScreen, (ULONG) screen,
- TAG_DONE )))
- return( 4L );
-
- GT_RefreshWindow( ChoosePSWnd, NULL );
-
- return( 0L );
- }
-
- void CloseChoosePSWindow( void )
- {
- if ( ChoosePSWnd ) {
- CloseWindow( ChoosePSWnd );
- ChoosePSWnd = NULL;
- }
-
- if ( ChoosePSGList ) {
- FreeGadgets( ChoosePSGList );
- ChoosePSGList = NULL;
- }
- }
-
- int HandleGotoPageIDCMP( void )
- {
- struct IntuiMessage *m;
- int (*func)(void);
- BOOL running = TRUE;
-
- while( m = GT_GetIMsg( GotoPageWnd->UserPort )) {
-
- CopyMem(( char * )m, ( char * )&GotoPageMsg, (long)sizeof( struct IntuiMessage ));
-
- GT_ReplyIMsg( m );
-
- switch ( GotoPageMsg.Class ) {
-
- case IDCMP_REFRESHWINDOW:
- GT_BeginRefresh( GotoPageWnd );
- GT_EndRefresh( GotoPageWnd, TRUE );
- break;
-
- case IDCMP_CLOSEWINDOW:
- running = GotoPageCloseWindow();
- break;
-
- case IDCMP_GADGETUP:
- case IDCMP_GADGETDOWN:
- func = ( void * )(( struct Gadget * )GotoPageMsg.IAddress )->UserData;
- running = func();
- break;
- }
- }
- return( running );
- }
-
- int OpenGotoPageWindow( void )
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD wleft = GotoPageLeft, wtop = GotoPageTop, ww, wh;
-
- ComputeFont( GotoPageWidth, GotoPageHeight );
-
- ww = ComputeX( GotoPageWidth );
- wh = ComputeY( GotoPageHeight );
-
- if (( wleft + ww + OffX + screen->WBorRight ) > screen->Width ) wleft = screen->Width - ww;
- if (( wtop + wh + OffY + screen->WBorBottom ) > screen->Height ) wtop = screen->Height - wh;
-
- if ( ! ( g = CreateContext( &GotoPageGList )))
- return( 1L );
-
- for( lc = 0, tc = 0; lc < GotoPage_CNT; lc++ ) {
-
- CopyMem((char * )&GotoPageNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
-
- ng.ng_VisualInfo = my_VisualInfo;
- ng.ng_TextAttr = Font;
- ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
- ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
- ng.ng_Width = ComputeX( ng.ng_Width );
- ng.ng_Height = ComputeY( ng.ng_Height);
-
- GotoPageGadgets[ lc ] = g = CreateGadgetA((ULONG)GotoPageGTypes[ lc ], g, &ng, ( struct TagItem * )&GotoPageGTags[ tc ] );
-
- while( GotoPageGTags[ tc ] ) tc += 2;
- tc++;
-
- if ( NOT g )
- return( 2L );
- }
-
- if ( ! ( GotoPageWnd = OpenWindowTags( NULL,
- WA_Left, wleft,
- WA_Top, wtop,
- WA_Width, ww + OffX + screen->WBorRight,
- WA_Height, wh + OffY + screen->WBorBottom,
- WA_IDCMP, INTEGERIDCMP|IDCMP_GADGETDOWN|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
- WA_Gadgets, (ULONG) GotoPageGList,
- WA_Title, (ULONG) GotoPageWdt,
- WA_ScreenTitle, (ULONG) "Goto Page",
- WA_PubScreen, (ULONG) screen,
- TAG_DONE )))
- return( 4L );
-
- GT_RefreshWindow( GotoPageWnd, NULL );
-
- return( 0L );
- }
-
- void CloseGotoPageWindow( void )
- {
- if ( GotoPageWnd ) {
- CloseWindow( GotoPageWnd );
- GotoPageWnd = NULL;
- }
-
- if ( GotoPageGList ) {
- FreeGadgets( GotoPageGList );
- GotoPageGList = NULL;
- }
- }
-